package com.xiguthings.xiniu.iot.post.common.entity;

import java.util.Map;

import com.xiguthings.xiniu.iot.post.common.HttpUtils;

/**
 * 发送post后，生存的发送结果
 * @author jiawenbin
 *
 */
public class PostResult {
	private Map<String, Object> responce;
	private int tryCount;
	private String responceMessage;
	private Exception exception;
	
	public PostResult() {}
	
	public PostResult(Map<String, Object> resMap,int tryCount,String responceMessage,Exception postException) {
		super();
		this.responce = resMap;
		this.tryCount = tryCount;
		this.responceMessage = responceMessage;
		this.exception = postException;
    }
	


	public Map<String, Object> getResponce() {
		return responce;
	}

	public void setResponce(Map<String, Object> responce) {
		this.responce = responce;
	}

	public int getTryCount() {
		return tryCount;
	}
	public void setTryCount(int tryCount) {
		this.tryCount = tryCount;
	}
	public String getResponceMessage() {
		return responceMessage;
	}
	public void setResponceMessage(String responceMessage) {
		this.responceMessage = responceMessage;
	}
	public Exception getException() {
		return exception;
	}
	public void setException(Exception exception) {
		this.exception = exception;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((exception == null) ? 0 : exception.hashCode());
		result = prime * result + ((responce == null) ? 0 : responce.hashCode());
		result = prime * result + ((responceMessage == null) ? 0 : responceMessage.hashCode());
		result = prime * result + tryCount;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PostResult other = (PostResult) obj;
		if (exception == null) {
			if (other.exception != null)
				return false;
		} else if (!exception.equals(other.exception))
			return false;
		if (responce == null) {
			if (other.responce != null)
				return false;
		} else if (!responce.equals(other.responce))
			return false;
		if (responceMessage == null) {
			if (other.responceMessage != null)
				return false;
		} else if (!responceMessage.equals(other.responceMessage))
			return false;
		if (tryCount != other.tryCount)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "PostResult [responce=" + responce + ", tryCount=" + tryCount + ", responceMessage=" + responceMessage
				+ ", exception=" + exception + "]";
	}
	
	
	
}
